package com.group9.handinhand.service.so;

import org.apache.commons.lang.ArrayUtils;

import com.group9.handinhand.dao.model.CommunityPost;

/** 
 * Class for service of Community post
 * @author Egeid
 *
 */
public class CommunityPostSO extends PostSO {

	private CommunitySO community;
	/**
	 * converts the community post model objects
	 * @param ignoreProperties
	 * @return
	 */
	public CommunityPost convertToModelObject(String... ignoreProperties) {
		CommunityPost model = (CommunityPost) convert(new CommunityPost(), 
			(String[]) ArrayUtils.addAll(ignoreProperties, new String[]{"community","user"}));
		model.setUser(super.getUser().convertToModelObject(new String[]{"socialUsers"}));
		model.setCommunity(community.convertToModelObject(new String[]{"moderators", "posts", "events","requests","offers"}));
		return model;
	}
	public CommunitySO getCommunity() {
		return community;
	}

	public void setCommunity(CommunitySO community) {
		this.community = community;
	}

	@Override
	public String toString() {
		return "CommunityPostSO [community=" + community + "]";
	}
	
	
	
}
